
###############################################################################
## CuteTimer
## Speed-run plugin for EventScripts Python
## Officially supported games: CS:S OB
##
## File: utils/filesystem.py
## Author: zoomj
## Description: file system helper functions
## Version: 0.1

from os.path import abspath
import es

__all__ = [
'get_game_path',
'get_cutetimer_path',
'get_extensions_path'
]

cutetimer_path = abspath(es.getAddonPath('cutetimer')).replace('\\', '/')
game_path = abspath('%s/../../..' % cutetimer_path).replace('\\', '/')
extensions_path = '%s/extensions' % cutetimer_path

def get_game_path(sub_dir = None):
    if sub_dir:
        sub_dir = str(sub_dir).replace('\\', '/')
        return '%s/%s' % (game_path, sub_dir)
    return game_path
    
def get_cutetimer_path(sub_dir = None):
    if sub_dir:
        sub_dir = str(sub_dir).replace('\\', '/')
        return '%s/%s' % (cutetimer_path, sub_dir)
    return cutetimer_path
        
def get_extensions_path(sub_dir = None):
    if sub_dir:
        sub_dir = str(sub_dir).replace('\\', '/')
        return '%s/%s' % (extensions_path, sub_dir)
    return extensions_path
